package com.joint.web.action.app;

import com.joint.core.entity.ProInfo;
import com.joint.core.entity.ProSignIn;
import com.joint.core.service.ProInfoService;
import com.joint.core.service.ProSignInService;
import com.joint.web.action.BaseAction;
import com.opensymphony.xwork2.ModelDriven;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.convention.annotation.ParentPackage;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 后台Action类 - 项目签到管理
 */
@ParentPackage("app")
public class ProsigninAction extends BaseAction implements ModelDriven<ProSignIn> {

    private static final long serialVersionUID = -4787241461181578464L;

    private ProSignIn proSignIn;
	private List<ProSignIn> proSignInList;

    private ProInfo proInfo;
    private String proinfoId;
//	private Users users;

    @Resource
    private ProInfoService proInfoService;

    @Resource
    private ProSignInService proSignInService;

	/**
	 * 联系人信息详情
     *
	 * @return String
	 * @throws Exception
	 */
	public String getDetail() throws Exception {

        if (StringUtils.isNotEmpty(keyId)) {
            proSignIn = proSignInService.get(keyId);
            if (proSignIn != null) {
                Map<String, Object> data = proSignInService.getDetailMap(proSignIn);
                return ajaxHtmlAppResult(1, "", JSONObject.fromObject(data));
            }
        }
        return ajaxHtmlAppResult(0, "无法找到该文档，可能已被删除！", null);
	}



	@Override
	public ProSignIn getModel() {
		if(proSignIn == null){
            proSignIn = new ProSignIn();
		}
		return proSignIn;
	}

    public String getProinfoId() {
        return proinfoId;
    }

    public void setProinfoId(String proinfoId) {
        this.proinfoId = proinfoId;
    }
}
